/**
 * This is a generated class and is not intended for modification.  To customize behavior
 * of this value object you may modify the generated sub-class of this class - VoTrasactionMaster.as.
 */

package com.model.valueObjects
{
import com.adobe.fiber.services.IFiberManagingService;
import com.adobe.fiber.util.FiberUtils;
import com.adobe.fiber.valueobjects.IValueObject;
import flash.events.Event;
import flash.events.EventDispatcher;
import mx.binding.utils.ChangeWatcher;
import mx.events.PropertyChangeEvent;
import mx.validators.ValidationResult;

import flash.net.registerClassAlias;
import flash.net.getClassByAlias;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;

use namespace model_internal;

[ExcludeClass]
public class _Super_VoTrasactionMaster extends flash.events.EventDispatcher implements com.adobe.fiber.valueobjects.IValueObject
{
    model_internal static function initRemoteClassAliasSingle(cz:Class) : void
    {
        try
        {
            if (flash.net.getClassByAlias("VoTrasactionMaster") == null)
            {
                flash.net.registerClassAlias("VoTrasactionMaster", cz);
            }
        }
        catch (e:Error)
        {
            flash.net.registerClassAlias("VoTrasactionMaster", cz);
        }
    }

    model_internal static function initRemoteClassAliasAllRelated() : void
    {
    }

    model_internal var _dminternal_model : _VoTrasactionMasterEntityMetadata;

    /**
     * properties
     */
    private var _internal_cre_datetime : String;
    private var _internal_trans_status : String;
    private var _internal_po_sc_detserialnumber_fk : int;
    private var _internal_pro_status : String;
    private var _internal_cre_userid_fk : int;
    private var _internal_pro_serialnumber_fk : int;
    private var _internal_serialnumber : int;
    private var _internal_trans_pro_qty : int;
    private var _internal_trans_date : String;
    private var _internal_activestatus : Boolean;
    private var _internal_trans_type : String;
    private var _internal_gr_do_detserialnumber_fk : int;
    private var _internal_warehouse_serialnumber_fk : int;

    private static var emptyArray:Array = new Array();


    /**
     * derived property cache initialization
     */
    model_internal var _cacheInitialized_isValid:Boolean = false;

    model_internal var _changeWatcherArray:Array = new Array();

    public function _Super_VoTrasactionMaster()
    {
        _model = new _VoTrasactionMasterEntityMetadata(this);

        // Bind to own data properties for cache invalidation triggering
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "cre_datetime", model_internal::setterListenerCre_datetime));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "trans_status", model_internal::setterListenerTrans_status));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "pro_status", model_internal::setterListenerPro_status));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "trans_date", model_internal::setterListenerTrans_date));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "trans_type", model_internal::setterListenerTrans_type));

    }

    /**
     * data property getters
     */

    [Bindable(event="propertyChange")]
    public function get cre_datetime() : String
    {
        return _internal_cre_datetime;
    }

    [Bindable(event="propertyChange")]
    public function get trans_status() : String
    {
        return _internal_trans_status;
    }

    [Bindable(event="propertyChange")]
    public function get po_sc_detserialnumber_fk() : int
    {
        return _internal_po_sc_detserialnumber_fk;
    }

    [Bindable(event="propertyChange")]
    public function get pro_status() : String
    {
        return _internal_pro_status;
    }

    [Bindable(event="propertyChange")]
    public function get cre_userid_fk() : int
    {
        return _internal_cre_userid_fk;
    }

    [Bindable(event="propertyChange")]
    public function get pro_serialnumber_fk() : int
    {
        return _internal_pro_serialnumber_fk;
    }

    [Bindable(event="propertyChange")]
    public function get serialnumber() : int
    {
        return _internal_serialnumber;
    }

    [Bindable(event="propertyChange")]
    public function get trans_pro_qty() : int
    {
        return _internal_trans_pro_qty;
    }

    [Bindable(event="propertyChange")]
    public function get trans_date() : String
    {
        return _internal_trans_date;
    }

    [Bindable(event="propertyChange")]
    public function get activestatus() : Boolean
    {
        return _internal_activestatus;
    }

    [Bindable(event="propertyChange")]
    public function get trans_type() : String
    {
        return _internal_trans_type;
    }

    [Bindable(event="propertyChange")]
    public function get gr_do_detserialnumber_fk() : int
    {
        return _internal_gr_do_detserialnumber_fk;
    }

    [Bindable(event="propertyChange")]
    public function get warehouse_serialnumber_fk() : int
    {
        return _internal_warehouse_serialnumber_fk;
    }

    /**
     * data property setters
     */

    public function set cre_datetime(value:String) : void
    {
        var oldValue:String = _internal_cre_datetime;
        if (oldValue !== value)
        {
            _internal_cre_datetime = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "cre_datetime", oldValue, _internal_cre_datetime));
        }
    }

    public function set trans_status(value:String) : void
    {
        var oldValue:String = _internal_trans_status;
        if (oldValue !== value)
        {
            _internal_trans_status = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "trans_status", oldValue, _internal_trans_status));
        }
    }

    public function set po_sc_detserialnumber_fk(value:int) : void
    {
        var oldValue:int = _internal_po_sc_detserialnumber_fk;
        if (oldValue !== value)
        {
            _internal_po_sc_detserialnumber_fk = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "po_sc_detserialnumber_fk", oldValue, _internal_po_sc_detserialnumber_fk));
        }
    }

    public function set pro_status(value:String) : void
    {
        var oldValue:String = _internal_pro_status;
        if (oldValue !== value)
        {
            _internal_pro_status = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pro_status", oldValue, _internal_pro_status));
        }
    }

    public function set cre_userid_fk(value:int) : void
    {
        var oldValue:int = _internal_cre_userid_fk;
        if (oldValue !== value)
        {
            _internal_cre_userid_fk = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "cre_userid_fk", oldValue, _internal_cre_userid_fk));
        }
    }

    public function set pro_serialnumber_fk(value:int) : void
    {
        var oldValue:int = _internal_pro_serialnumber_fk;
        if (oldValue !== value)
        {
            _internal_pro_serialnumber_fk = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pro_serialnumber_fk", oldValue, _internal_pro_serialnumber_fk));
        }
    }

    public function set serialnumber(value:int) : void
    {
        var oldValue:int = _internal_serialnumber;
        if (oldValue !== value)
        {
            _internal_serialnumber = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "serialnumber", oldValue, _internal_serialnumber));
        }
    }

    public function set trans_pro_qty(value:int) : void
    {
        var oldValue:int = _internal_trans_pro_qty;
        if (oldValue !== value)
        {
            _internal_trans_pro_qty = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "trans_pro_qty", oldValue, _internal_trans_pro_qty));
        }
    }

    public function set trans_date(value:String) : void
    {
        var oldValue:String = _internal_trans_date;
        if (oldValue !== value)
        {
            _internal_trans_date = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "trans_date", oldValue, _internal_trans_date));
        }
    }

    public function set activestatus(value:Boolean) : void
    {
        var oldValue:Boolean = _internal_activestatus;
        if (oldValue !== value)
        {
            _internal_activestatus = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "activestatus", oldValue, _internal_activestatus));
        }
    }

    public function set trans_type(value:String) : void
    {
        var oldValue:String = _internal_trans_type;
        if (oldValue !== value)
        {
            _internal_trans_type = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "trans_type", oldValue, _internal_trans_type));
        }
    }

    public function set gr_do_detserialnumber_fk(value:int) : void
    {
        var oldValue:int = _internal_gr_do_detserialnumber_fk;
        if (oldValue !== value)
        {
            _internal_gr_do_detserialnumber_fk = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "gr_do_detserialnumber_fk", oldValue, _internal_gr_do_detserialnumber_fk));
        }
    }

    public function set warehouse_serialnumber_fk(value:int) : void
    {
        var oldValue:int = _internal_warehouse_serialnumber_fk;
        if (oldValue !== value)
        {
            _internal_warehouse_serialnumber_fk = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "warehouse_serialnumber_fk", oldValue, _internal_warehouse_serialnumber_fk));
        }
    }

    /**
     * Data property setter listeners
     *
     * Each data property whose value affects other properties or the validity of the entity
     * needs to invalidate all previously calculated artifacts. These include:
     *  - any derived properties or constraints that reference the given data property.
     *  - any availability guards (variant expressions) that reference the given data property.
     *  - any style validations, message tokens or guards that reference the given data property.
     *  - the validity of the property (and the containing entity) if the given data property has a length restriction.
     *  - the validity of the property (and the containing entity) if the given data property is required.
     */

    model_internal function setterListenerCre_datetime(value:flash.events.Event):void
    {
        _model.invalidateDependentOnCre_datetime();
    }

    model_internal function setterListenerTrans_status(value:flash.events.Event):void
    {
        _model.invalidateDependentOnTrans_status();
    }

    model_internal function setterListenerPro_status(value:flash.events.Event):void
    {
        _model.invalidateDependentOnPro_status();
    }

    model_internal function setterListenerTrans_date(value:flash.events.Event):void
    {
        _model.invalidateDependentOnTrans_date();
    }

    model_internal function setterListenerTrans_type(value:flash.events.Event):void
    {
        _model.invalidateDependentOnTrans_type();
    }


    /**
     * valid related derived properties
     */
    model_internal var _isValid : Boolean;
    model_internal var _invalidConstraints:Array = new Array();
    model_internal var _validationFailureMessages:Array = new Array();

    /**
     * derived property calculators
     */

    /**
     * isValid calculator
     */
    model_internal function calculateIsValid():Boolean
    {
        var violatedConsts:Array = new Array();
        var validationFailureMessages:Array = new Array();

        var propertyValidity:Boolean = true;
        if (!_model.cre_datetimeIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_cre_datetimeValidationFailureMessages);
        }
        if (!_model.trans_statusIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_trans_statusValidationFailureMessages);
        }
        if (!_model.pro_statusIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_pro_statusValidationFailureMessages);
        }
        if (!_model.trans_dateIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_trans_dateValidationFailureMessages);
        }
        if (!_model.trans_typeIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_trans_typeValidationFailureMessages);
        }

        model_internal::_cacheInitialized_isValid = true;
        model_internal::invalidConstraints_der = violatedConsts;
        model_internal::validationFailureMessages_der = validationFailureMessages;
        return violatedConsts.length == 0 && propertyValidity;
    }

    /**
     * derived property setters
     */

    model_internal function set isValid_der(value:Boolean) : void
    {
        var oldValue:Boolean = model_internal::_isValid;
        if (oldValue !== value)
        {
            model_internal::_isValid = value;
            _model.model_internal::fireChangeEvent("isValid", oldValue, model_internal::_isValid);
        }
    }

    /**
     * derived property getters
     */

    [Transient]
    [Bindable(event="propertyChange")]
    public function get _model() : _VoTrasactionMasterEntityMetadata
    {
        return model_internal::_dminternal_model;
    }

    public function set _model(value : _VoTrasactionMasterEntityMetadata) : void
    {
        var oldValue : _VoTrasactionMasterEntityMetadata = model_internal::_dminternal_model;
        if (oldValue !== value)
        {
            model_internal::_dminternal_model = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "_model", oldValue, model_internal::_dminternal_model));
        }
    }

    /**
     * methods
     */


    /**
     *  services
     */
    private var _managingService:com.adobe.fiber.services.IFiberManagingService;

    public function set managingService(managingService:com.adobe.fiber.services.IFiberManagingService):void
    {
        _managingService = managingService;
    }

    model_internal function set invalidConstraints_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_invalidConstraints;
        // avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_invalidConstraints = value;
            _model.model_internal::fireChangeEvent("invalidConstraints", oldValue, model_internal::_invalidConstraints);
        }
    }

    model_internal function set validationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_validationFailureMessages;
        // avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_validationFailureMessages = value;
            _model.model_internal::fireChangeEvent("validationFailureMessages", oldValue, model_internal::_validationFailureMessages);
        }
    }

    model_internal var _doValidationCacheOfCre_datetime : Array = null;
    model_internal var _doValidationLastValOfCre_datetime : String;

    model_internal function _doValidationForCre_datetime(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfCre_datetime != null && model_internal::_doValidationLastValOfCre_datetime == value)
           return model_internal::_doValidationCacheOfCre_datetime ;

        _model.model_internal::_cre_datetimeIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isCre_datetimeAvailable && _internal_cre_datetime == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "cre_datetime is required"));
        }

        model_internal::_doValidationCacheOfCre_datetime = validationFailures;
        model_internal::_doValidationLastValOfCre_datetime = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfTrans_status : Array = null;
    model_internal var _doValidationLastValOfTrans_status : String;

    model_internal function _doValidationForTrans_status(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfTrans_status != null && model_internal::_doValidationLastValOfTrans_status == value)
           return model_internal::_doValidationCacheOfTrans_status ;

        _model.model_internal::_trans_statusIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isTrans_statusAvailable && _internal_trans_status == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "trans_status is required"));
        }

        model_internal::_doValidationCacheOfTrans_status = validationFailures;
        model_internal::_doValidationLastValOfTrans_status = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfPro_status : Array = null;
    model_internal var _doValidationLastValOfPro_status : String;

    model_internal function _doValidationForPro_status(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfPro_status != null && model_internal::_doValidationLastValOfPro_status == value)
           return model_internal::_doValidationCacheOfPro_status ;

        _model.model_internal::_pro_statusIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isPro_statusAvailable && _internal_pro_status == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "pro_status is required"));
        }

        model_internal::_doValidationCacheOfPro_status = validationFailures;
        model_internal::_doValidationLastValOfPro_status = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfTrans_date : Array = null;
    model_internal var _doValidationLastValOfTrans_date : String;

    model_internal function _doValidationForTrans_date(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfTrans_date != null && model_internal::_doValidationLastValOfTrans_date == value)
           return model_internal::_doValidationCacheOfTrans_date ;

        _model.model_internal::_trans_dateIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isTrans_dateAvailable && _internal_trans_date == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "trans_date is required"));
        }

        model_internal::_doValidationCacheOfTrans_date = validationFailures;
        model_internal::_doValidationLastValOfTrans_date = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfTrans_type : Array = null;
    model_internal var _doValidationLastValOfTrans_type : String;

    model_internal function _doValidationForTrans_type(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfTrans_type != null && model_internal::_doValidationLastValOfTrans_type == value)
           return model_internal::_doValidationCacheOfTrans_type ;

        _model.model_internal::_trans_typeIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isTrans_typeAvailable && _internal_trans_type == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "trans_type is required"));
        }

        model_internal::_doValidationCacheOfTrans_type = validationFailures;
        model_internal::_doValidationLastValOfTrans_type = value;

        return validationFailures;
    }
    

}

}
